package com.water.devtool;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.water.devtool.bean.ClassDefine;
import com.water.devtool.define.EntityBean;
import com.water.devtool.define.ModularBean;
import com.water.devtool.define.ProjectBean;

@SuppressWarnings("serial")
public class Context extends HashMap {
	private ProjectBean projectBean;
	private ModularBean modularBean;
	private EntityBean entityBean;
	private List<ClassDefine> classDefineds = new ArrayList<ClassDefine>();

	public ProjectBean getProjectBean() {
		return projectBean;
	}

	public void setProjectBean(ProjectBean projectBean) {
		put("projectBean",projectBean);
		put("project", projectBean.getCode());
		this.projectBean = projectBean;
	}

	public ModularBean getModularBean() {
		return modularBean;
	}

	public void setModularBean(ModularBean modularBean) {
		put("modularBean",modularBean);
		put("modular", modularBean.getCode());
		this.modularBean = modularBean;
	}

	public EntityBean getEntityBean() {
		return entityBean;
	}

	public void setEntityBean(EntityBean entityBean) {
		put("entityBean",entityBean);
		put("entityCode", entityBean.getCode());
		put("entityJavaName", entityBean.getJavaName());
		
		this.entityBean = entityBean;
		if (entityBean.getModular() != null) {
			setModularBean(entityBean.getModular());
			if (entityBean.getModular().getProject() != null) {
				setProjectBean(entityBean.getModular().getProject());
			}
		}

	}

	public void addClassDefine(ClassDefine clazz) {
		classDefineds.add(clazz);
	}

	public List<ClassDefine> getClassDefineds() {
		return classDefineds;
	}

	public void setClassDefineds(List<ClassDefine> classDefineds) {
		this.classDefineds = classDefineds;
	}

}
